<template>
  <page-header-wrapper>
    <a-card class="search-card  m-b-20" :bordered="false">
      <!-- <div class="table-page-search-wrapper"> -->
        <!-- <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="14" :lg="14" :xl="12" :xxl="8" :sm="24">
              <a-form-item label="问题提问">
                <a-input v-model="queryParam.DepartmentName" placeholder="请输入问题提问" @pressEnter="$refs.table.refresh(true)"/>
              </a-form-item>
            </a-col>
            <a-col :md="10" :lg="10" :xl="8" :xxl="6" :sm="24">
              <div class="table-page-search-submitButtons">
                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                <a-button style="margin-left: 8px" @click="handleReset">重置</a-button>
              </div>
            </a-col>
          </a-row>
        </a-form> -->
      <!-- </div> -->
    </a-card>
    <a-card :bordered="false">
      <s-table
        ref="table"
        :scroll="{x: true}"
        :rowKey="record => record.ID"
        :columns="columns"
        :data="loadData"
        :pagination="{ showTotal: total => `共 ${total} 条` }"
      >
        <!-- 表格操作栏 -->
        <!-- <template slot="tabAction">
          <a-button class="m-r-10" type="primary" icon="plus" @click="handleOperation('add')">新增咨询</a-button>
        </template> -->
        <span slot="image" slot-scope="text, record">
            <img :src="upload + record.Imgs" alt="图片" />
        </span>
        <span slot="isHot" slot-scope="text, record">
          <div v-if="record.RMTJ == 1">是</div>
          <div v-if="record.RMTJ == 0">否</div>
        </span>
        <span slot="action" slot-scope="text, record" style="height: auto;">
          <template>
            <!-- <a class="m-r-10" @click="handleOperation('addChild', record)">新增咨询</a> -->
            <a class="m-r-10" @click="handleOperation('通过',record)">通过</a>
            <a class="m-r-10" @click="handleOperation('驳回',record)">驳回</a>
          </template>
        </span>
      </s-table>
    </a-card>
    <!-- <edit-department :visible.sync="visibles" :propsData="propsData"></edit-department> -->
  </page-header-wrapper>
</template>

<script>
import { STable } from '@/components'
import { getQYZCListApi, postQYSHJGApi } from '@/api/service'
const columns = [
  {
    title: '服务名称',
    align: 'left',
    dataIndex: 'NAME',
    // ellipsis: true,
  },
  {
    title: '公司名称',
    align: 'center',
    dataIndex: 'GSNAME',
    ellipsis: false,
  },
  {
    title: '参考服务价格(可议价)',
    align: 'center',
    dataIndex: 'CKFWJG',
    ellipsis: false,
  },
  {
    title: '公司地址',
    align: 'center',
    dataIndex: 'GSDZ',
    ellipsis: false,
  },
  {
    title: '身份证号',
    align: 'center',
    dataIndex: 'SFZH',
    ellipsis: false,
  },
  {
    title: '联系方式',
    align: 'center',
    dataIndex: 'LXFS',
    ellipsis: false,
  },
  {
    title: '审核状态',
    align: 'center',
    dataIndex: 'SHZT',
    ellipsis: false,
  },
  {
    title: '公司logo',
    align: 'center',
    dataIndex: 'Logo',
    ellipsis: false,
  },
  {
    title: '封面图片',
    align: 'center',
    dataIndex: 'GSZZZS',
    ellipsis: false,
  },
  {
    title: '申请时间',
    align: 'center',
    dataIndex: 'AddTime',
  },
  {
    title: '操作',
    align: 'center',
    width: '200px',
    fixed: 'right',
    scopedSlots: { customRender: 'action' }
  }
]


export default {
  name: 'EnterpriseRev',
  components: {
    STable,
  },
  data () {
    this.columns = columns
    return {
      visibles: false,
      upload:process.env.VUE_APP_API_BASE_URL,
      // 查询参数
      queryParam: {
        // DepartmentName: '',
        // userId: this.$store.getters.loginName,
        FID:1
      },
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        return getQYZCListApi(Object.assign(parameter, this.queryParam)).then(res => {
          return res
        })
      },
      propsData: {
        type: 'add',
        id: ''
      }
    }
  },
  methods: {
    handleOperation (type, record) {
      console.log('typerecord',type, record);
      // if (type = '驳回') {
      //   this.visibles = true
      //   this.propsData = { type, record }
      // }else{
        postQYSHJGApi({
          ID:record.ID,
          SHZT:type,
          SHRID:'1',
        }).then(res => {
          console.log('res',res);
          // this.$message.success('入会申请已', type)
          this.$notification.open({
            message: '入会申请审核',
            description:
              '入会申请已' + type,
          });
        }).catch((err) => {
          this.$message.error(err, 2.5)
        }).finally(() => {
          this.$refs.table.refresh(true)
        })
      // }

    },
    handleReset () {
      this.queryParam = {
        DepartmentName: '',
        userId: this.$store.getters.loginName
      }
      this.$refs.table.refresh()
    }
  }
}
</script>
